# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

_realname=Vulkan-Docs
pkgbase=mingw-w64-vulkan-docs
pkgname=("${MINGW_PACKAGE_PREFIX}-vulkan-docs")
conflicts=("${MINGW_PACKAGE_PREFIX}-vulkan-html-docs" "${MINGW_PACKAGE_PREFIX}-vulkan-man-pages")
replaces=("${MINGW_PACKAGE_PREFIX}-vulkan-html-docs" "${MINGW_PACKAGE_PREFIX}-vulkan-man-pages")
pkgdesc="Vulkan documentation (mingw-w64)"
pkgver=1.1.92
pkgrel=1
arch=('any')
url="https://www.khronos.org/vulkan/"
groups=("${MINGW_PACKAGE_PREFIX}-vulkan-devel")
makedepends=("${MINGW_PACKAGE_PREFIX}-asciidoctor"
             "${MINGW_PACKAGE_PREFIX}-python3")
license=('custom')
_commit=279452463adf97364575ea9e5bdf17e5b5a0a74c
source=(git+https://github.com/KhronosGroup/Vulkan-Docs.git#commit=${_commit}
        remove-pdf-generating.patch)
sha256sums=('SKIP'
            'f56984195b9004692a15a6558686f581406937b1f58fc5010fab466e6d5fff2d')

prepare() {
  cd ${_realname}
  patch -p1 -i ${srcdir}/remove-pdf-generating.patch
}

build() {
  cd "${srcdir}/${_realname}"
  LANG="en_US.UTF8" make allman
  ./makeKHR
}

package() {
  cd "${srcdir}/${_realname}"
  install -dm755 "${pkgdir}${MINGW_PREFIX}/share/doc/vulkan"
  install -dm755 "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}"

  mv -v out/1.0/* "${pkgdir}${MINGW_PREFIX}/share/doc/vulkan/"

  install -m644 doc/specs/vulkan/copyright-ccby.txt ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/copyright-ccby.txt
  install -m644 doc/specs/vulkan/copyright-spec.txt ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/copyright-spec.txt
}
